package com.thousandsunny;

import com.thousandsunny.common.mq.PayLoad;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableOAuth2Client;

import java.util.UUID;

/**
 * @author Savitar
 */
@SpringBootApplication
@EnableDiscoveryClient
@EnableScheduling
@EnableOAuth2Client
public class ProducerApplication {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public static void main(String[] args) {
        SpringApplication.run(ProducerApplication.class, args);
    }

    //    @Scheduled(fixedRate = 1000)
    public void sch() {
        rabbitTemplate.convertAndSend("tomorrowClass", new PayLoad(UUID.randomUUID() + "", 11));
    }

}

